﻿<%@ Page Language="C#" MasterPageFile="~/MMhome.Master" AutoEventWireup="true" CodeBehind="UserCusManager.aspx.cs"
    Inherits="MobileManager.UserCusManager" Title="客户管理" %>

<%@ Register Src="~/UserControl/SMMenu.ascx" TagName="Menu" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .tdInfo
        {
            text-align: left;
            height: 40px;
            font-size: 12px;
        }
        .txtInfo
        {
            width: 100px;
            height: 20px;
            background-color: White;
            border-style: none;
            border: solid 1px #9999CC;
        }
        .divLeft
        {
            width: 165px;
            list-style: none;
            margin-left: 10px;
            margin-right: 5px;
            margin-top: 20px;
            float: left;
        }
        .divRight
        {
            float: left;
            margin-top: 10px;
            margin-right: 10px;
        }
        .TreeNodeInfo
        {
            margin-top: 5px;
            margin-bottom: 5px;
            font-size: 12px;
            margin-left: 2px;
            margin-right: 2px;
            font-weight: bold;
            color: #666666;
        }
        .TreeNodeInfoSelected
        {
            margin-top: 5px;
            margin-bottom: 5px;
            font-size: 12px;
            margin-left: 2px;
            margin-right: 2px;
            font-weight: bold;
            color: #6666FF;
        }
    </style>

    <script type="text/javascript">
        //JS操作TreeView的CheckBox选中或取消
        function client_OnTreeNodeChecked(evt) {
            var obj = getCurrentNode(evt);
            var treeNodeFound = false;
            var checkedState;
            if (obj.tagName == "INPUT" && obj.type == "checkbox") {
                checkedState = obj.checked;
                var curNode = getParentNode(obj);
                changeNodeState(curNode, checkedState);
            }
        }

        function getCurrentNode(evt) {
            var obj;
            if (window.event)
                obj = window.event.srcElement;
            else
                obj = (evt ? evt : (window.event ? window.event : null)).target;
            return obj;
        }

        function getParentNode(node) {
            do {
                node = node.parentNode;
            }
            while (node.tagName != "TABLE")
            return node;
        }

        function changeNodeState(node, state) {
            if (node.nextSibling != null && node.nextSibling.tagName == "DIV") {
                var cbArr = node.nextSibling.getElementsByTagName("INPUT");
                for (var i = 0; i < cbArr.length; i++) {
                    if (cbArr[i].type == "checkbox") cbArr[i].checked = state;
                }
            }
            if (state) {
                var parentArr = node.parentNode.previousSibling.getElementsByTagName("INPUT");
                for (i = 0; i < parentArr.length; i++) {
                    if (parentArr[i].type == "checkbox") parentArr[i].checked = state;
                }
            }
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderMain" runat="server">
    <div style="width: 100%">
        <div class="divLeft">
            <uc1:Menu ID="uc1menu" runat="server" />
        </div>
        <div class="divRight" style="text-align: center;">
            <table style="width: 100%; margin-top: 10px;">
                <tr>
                    <td style="margin-left: 5%; width: 30%;">
                        <asp:TreeView ID="TVusers" runat="server" OnSelectedNodeChanged="TVusers_SelectedNodeChanged"
                            ShowLines="true">
                            <NodeStyle Font-Bold="true" ForeColor="#666666" />
                        </asp:TreeView>
                    </td>
                    <td align="left" style="margin-left: 15px;">
                        <asp:TreeView ID="TVcustomers" runat="server" ShowCheckBoxes="All" onclick="client_OnTreeNodeChecked(event)"
                            ShowLines="true">
                            <NodeStyle Font-Bold="true" ForeColor="#666666" />
                        </asp:TreeView>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td align="left">
                        <asp:Button ID="btnSave" runat="server" Text="保 存" CssClass="button_blue" OnClick="btnSave_Click"
                            Width="70px" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
</asp:Content>
